#define NDEBUG
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <string>
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/time.h>
#include <sys/types.h>
//#include <sys/sysinfo.h>
#include <cstdlib>
#include <cfloat>
#include <cstddef>
#include <stdexcept>
#include <cstdio>
#include <map>
#include <sstream>
#include <cctype>
#include <iomanip>
#include <sstream>
#include <vector>
#include <limits>

#define likely(expr) (__builtin_expect(!!(expr), 1))
#define unlikely(expr) (__builtin_expect(!!(expr), 1))

using std::string;
using std::vector;
using std::pair;

bool operator<(pair<int, string>& p1, pair<int, string>& p2) {
  if (p1.first != p2.first) {
    return p1.first < p2.first;
  }
  return p1.second.compare(p2.second) < 0;
}

struct StringPart {
	const char * begin;
	const char * end;
	StringPart() {
		begin = NULL;
		end = NULL;
	}
	const char & operator[] (int i) const {
		return begin[i];
	}
	int size() const {
		return end-begin;
	}
	bool operator == (const StringPart & o) const {
		return size()==o.size() && !memcmp(begin, o.begin, size());
	}
	bool operator != (const StringPart & o) const {
		return size()!=o.size() || memcmp(begin, o.begin, size());
	}
	bool operator < (const StringPart & o) const {
		if(size()!=o.size()) {
			return size() < o.size();
		}
		return memcmp(begin, o.begin, size())<0;
	}
	unsigned int toCode4() const {
		int sz = size();
		if(3<=sz) {
			if(sz<4) {
				return *(unsigned int*)begin & 0x00FFFFFF;
			}
			else {
				return *(unsigned int*)begin;
			}
		}
		else {
			if(2<=sz) {
				return *(unsigned short*)begin;
			}
			else if(1<=sz) {
				return *(unsigned char*)begin;
			}
		}
		return 0;
	}
};

struct Seq {
	//StringPart id;
	//string v_fam;
	int v_gene;
	int v_all;
	int j_gene;
	int j_all;
	StringPart junc;
	vector<unsigned long long> muts;
};

using std::min;
using std::max;

inline int LevenshteinDistance(const StringPart& s1, const StringPart& s2) {
  int sz1 = s1.size();
  int sz2 = s2.size();
  int dp[sz1 + 1][sz2 + 1];
  for (size_t i = 0; i <= sz1; i++) {
    dp[i][0] = i;
  }
  for (size_t i = 0; i <= sz2; i++) {
    dp[0][i] = i;
  }
  for (size_t i = 1; i <= sz1; i++) {
    for (size_t j = 1; j <= sz2; j++) {
      dp[i][j] = min(min(dp[i - 1][j] + 1, dp[i][j - 1] + 1), dp[i - 1][j - 1] + (s1[i - 1] == s2[j - 1] ? 0 : 1));
    }
  }
  return dp[sz1][sz2];
}

inline int HammingDistance(const StringPart& s1, const StringPart& s2) {
	int n = s1.size();
	assert(s2.size()==n);
	int ret = 0;
	for(int i=0; i<n; ++i) {
		if(s1[i]!=s2[i]) {
			++ret;
		}
	}
	return ret;
}

inline int vCompare(const Seq& s1, const Seq& s2) {
  if (s1.v_gene!=s2.v_gene) {
    return 8;
  }
  if (s1.v_all!=s2.v_all) {
    return 1;
  }
  return 0;
}

inline int jCompare(const Seq& s1, const Seq& s2) {
  if (s1.j_gene!=s2.j_gene) {
    return 8;
  }
  if (s1.j_all!=s2.j_all) {
    return 1;
  }
  return 0;
}

inline int SharedMuts2(const Seq& s1, const Seq& s2) {
  int bonus = 0;
  size_t p1 = 0, p2 = 0;
  while (p1 < s1.muts.size() && p2 < s2.muts.size()) {
    if (s1.muts[p1] < s2.muts[p2]) {
      p1++;
    } else if (s2.muts[p2] < s1.muts[p1]) {
      p2++;
    } else {
      p1++;
      p2++;
      ++bonus;
    }
  }
  return bonus;
}

double GetScore(const Seq& s1, const Seq& s2) {
  if (s1.junc.size() == s2.junc.size()) {
    int editLength = s1.junc.size();
    int vPenalty = vCompare(s1, s2);
    int jPenalty = jCompare(s1, s2);
    int LD = HammingDistance(s1.junc, s2.junc);
    int easyPenalty = LD+vPenalty+jPenalty;
    if(editLength*32<easyPenalty*100-min((int)s1.muts.size(), (int)s2.muts.size())*35) {
      return 10.0;
    }
    int mutCount = SharedMuts2(s1, s2);
    double mutBonus = mutCount * 0.35;
    if (mutBonus > (LD + vPenalty + jPenalty)) {
      return 0;
    }
    return ((LD + vPenalty + jPenalty) - mutBonus) / editLength;
  } else {
    int lenPenalty = abs((int)s1.junc.size()-(int)s2.junc.size());
    int editLength = min(s1.junc.size(), s2.junc.size());
    if(editLength*4<lenPenalty*25) {
      return 10.0;
    }
    int lenPenalty2 = lenPenalty + lenPenalty;
    int vPenalty = vCompare(s1, s2);
    int jPenalty = jCompare(s1, s2);
    int easyPenalty = lenPenalty+lenPenalty2+vPenalty+jPenalty;
    if(editLength*32<easyPenalty*100-min((int)s1.muts.size(), (int)s2.muts.size())*35) {
      return 10.0;
    }
    int mutCount = SharedMuts2(s1, s2);
    if(editLength*32<easyPenalty*100-mutCount*35) {
      return 10.0;
    }
    int LD = LevenshteinDistance(s1.junc, s2.junc);
    double mutBonus = mutCount * 0.35;
    if (mutBonus > (LD + vPenalty + jPenalty)) {
      return (lenPenalty2 + 0.001) / editLength;
    }
    return ((LD + vPenalty + jPenalty + lenPenalty2) - mutBonus) / editLength;
  }
}

int g_HexAsciiToValue[256];
struct HexAsciiToValueInit {
	HexAsciiToValueInit() {
		for(int i=0; i<256; ++i) {
			g_HexAsciiToValue[i] = 0;
		}
		for(int i=0; i<10; ++i) {
			g_HexAsciiToValue['0'+i] = i;
		}
		for(int i=0; i<6; ++i) {
			g_HexAsciiToValue['A'+i] = 10+i;
			g_HexAsciiToValue['a'+i] = 10+i;
		}
	}
};
HexAsciiToValueInit g_dmy_HexAsciiToValueInit;

int g_AsciiToKind[256];
struct AsciiToKindInit {
	AsciiToKindInit() {
		for(int i=0; i<256; ++i) {
			g_AsciiToKind[i] = 0;
		}
		for(char c='0'; c<='9'; ++c) {
			g_AsciiToKind[(unsigned char)c] = 1;
		}
		for(char c='A'; c<='Z'; ++c) {
			g_AsciiToKind[(unsigned char)c] = 1;
		}
		for(char c='a'; c<='z'; ++c) {
			g_AsciiToKind[(unsigned char)c] = 1;
		}
		g_AsciiToKind['_'] = 1;
		g_AsciiToKind['"'] = 2;
		g_AsciiToKind['\''] = 2;
	}
};
AsciiToKindInit g_dmy_AsciiToKindInit;

#define STR_CHAR8(a) ((char)(a))
#define STR_SHORT16(a) ((short)((((short)(a)>>8)&0xFF)|(((short)(a)<<8)&0xFF00)))
#define STR_INT24(a) ((int)((((int)(a)>>16)&0xFF)|((int)(a)&0xFF00)|(((int)(a)<<16)&0xFF0000)))
#define STR_INT32(a) ((int)((((int)(a)>>24)&0xFF)|(((int)(a)>>8)&0xFF00)|(((int)(a)<<8)&0xFF0000))|(((int)(a)<<24)&0xFF000000))
#define STR_LONGLONG64(a, b) ((long long)(STR_INT32(a)|((long long)STR_INT32(b)<<32)))

#define STR_CHAR8_EQ(p, a) (*(char*)(p)==STR_CHAR8(a))
#define STR_SHORT16_EQ(p, a) (*(short*)(p)==STR_SHORT16(a))
#define STR_INT24_EQ(p, a) (((*(int*)(p))&0x00FFFFFF)==STR_INT24(a))
#define STR_INT32_EQ(p, a) (*(int*)(p)==STR_INT32(a))
#define STR_LONGLONG64_EQ(p, a, b) (*(long long*)(p)==STR_LONGLONG64(a, b))

class MyJsonReader {
	vector<Seq> seqs;
	enum {
		STATE_START,
		STATE_END,
		STATE_ARRAY,
		STATE_ARRAY_END,
		STATE_OBJECT,
		STATE_KEY_END,
		STATE_OBJECT_END,
		STATE_SEQ_ID,
		STATE_JUNC_AA,
		STATE_V_GENE,
		STATE_V_GENE_OBJECT,
		STATE_V_GENE_OBJECT_END,
		STATE_V_GENE_ALL,
		STATE_V_GENE_GENE,
		STATE_J_GENE,
		STATE_J_GENE_OBJECT,
		STATE_J_GENE_OBJECT_END,
		STATE_J_GENE_ALL,
		STATE_J_GENE_GENE,
		STATE_VAR_MUTS_NT,
		STATE_VAR_MUTS_NT_OBJECT,
		STATE_VAR_MUTS_NT_OBJECT_END,
		STATE_VAR_MUTS_NT_MUTS,
		STATE_VAR_MUTS_NT_MUTS_ARRAY,
		STATE_VAR_MUTS_NT_MUTS_ARRAY_END,
		STATE_VAR_MUTS_NT_MUTS_OBJECT,
		STATE_VAR_MUTS_NT_MUTS_OBJECT_END,
		STATE_VAR_MUTS_NT_MUTS_LOC,
		STATE_VAR_MUTS_NT_MUTS_MUT,
		STATE_UNKNOWN,
		STATE_UNKNOWN_ARRAY,
		STATE_UNKNOWN_ARRAY_END,
		STATE_UNKNOWN_OBJECT,
		STATE_UNKNOWN_OBJECT_VALUE,
		STATE_UNKNOWN_OBJECT_END,
	};
	int state;
	int next_state;
	int unknown_return_state;
	vector<int> unknown_return_state_array;
	bool parse_string_pass(const char * & it, const char * const & end) {
		assert(it!=end);
		char delimiter;
		do {
			delimiter = *it;
			if(delimiter!=' ') {
				break;
			}
			++it;
			if(it==end) {
				return false;
			}
		} while(true);
		int kind = g_AsciiToKind[(unsigned char)delimiter];
		if(kind==0) {
			++it;
			return false;
		}
		else if(kind==1) {
			++it;
			while(it!=end) {
				char ch = *it;
				if(g_AsciiToKind[(unsigned char)ch]!=1) {
					break;
				}
				++it;
			}
			return true;
		}
		++it;
		while(true) {
			assert(it!=end);
			char ch = *it;
			if(ch==delimiter) {
				++it;
				break;
			}
			else if(ch=='\\') {
				++it;
				assert(it!=end);
			}
			++it;
		}
		return true;
	}
	bool parse_string(const char * & it, const char * const & end, StringPart & result) {
		assert(it!=end);
		char delimiter;
		do {
			delimiter = *it;
			if(delimiter!=' ') {
				break;
			}
			++it;
			if(it==end) {
				return false;
			}
		} while(true);
		int kind = g_AsciiToKind[(unsigned char)delimiter];
		if(kind==0) {
			++it;
			return false;
		}
		else if(kind==1) {
			result.begin = it;
			++it;
			while(it!=end) {
				char ch = *it;
				if(g_AsciiToKind[(unsigned char)ch]!=1) {
					break;
				}
				++it;
			}
			result.end = it;
			return true;
		}
		++it;
		result.begin = it;
		while(true) {
			assert(it!=end);
			char ch = *it;
			if(ch==delimiter) {
				result.end = it;
				++it;
				return true;
			}
			else if(ch=='\\') {
				++it;
				assert(it!=end);
			}
			++it;
		}
	}
public:
	MyJsonReader() {
		state = STATE_START;
		next_state = STATE_START;
		unknown_return_state = STATE_START;
	}
	void read(const char * & it, const char * const & end) {
		switch(state) {
		case STATE_START:
			if(end-it==1 && *it=='[') {
				state = STATE_ARRAY;
				return;
			}
			break;
		case STATE_ARRAY:
			if(end-it==3 && ((*(int*)it)&0x00FFFFFF)==STR_INT24('  {')) {
				seqs.push_back(Seq());
				state = STATE_OBJECT;
				return;
			}
			break;
		case STATE_ARRAY_END:
			if(end-it==1 && STR_CHAR8_EQ(it, ']')) {
				state = STATE_END;
				return;
			}
			break;
		case STATE_END:
			return;
			break;
		case STATE_OBJECT:
			if(15<=end-it) {
				long long v4 = *(long long*)(it+4);
				if(v4==STR_LONGLONG64('"v_g', 'ene"')) {
					if(STR_INT32_EQ(end-4, '": {')) {
						state = STATE_V_GENE_OBJECT;
						return;
					}
				}
				else if(v4==STR_LONGLONG64('"seq', '_id"')) {
					if(STR_INT24_EQ(end-3, '", ')) {
						return;
					}
					else if(STR_CHAR8_EQ(end-1, '"')) {
						state = STATE_OBJECT_END;
						return;
					}
				}
				else if(v4==STR_LONGLONG64('"j_g', 'ene"')) {
					if(STR_INT32_EQ(end-4, '": {')) {
						state = STATE_J_GENE_OBJECT;
						return;
					}
				}
				else if(v4==STR_LONGLONG64('"jun', 'c_aa')) {
					if(STR_INT32_EQ(it+12, '": "')) {
						if(STR_INT24_EQ(end-3, '", ')) {
							StringPart str;
							str.begin = it + 16;
							str.end = end - 3;
							seqs.back().junc = str;
							return;
						}
						else if(STR_CHAR8_EQ(end-1, '"')) {
							StringPart str;
							str.begin = it + 16;
							str.end = end - 1;
							seqs.back().junc = str;
							state = STATE_OBJECT_END;
							return;
						}
					}
				}
				else if(v4==STR_LONGLONG64('"var', '_mut')) {
					if(STR_LONGLONG64_EQ(it+12, 's_nt', '": {') && end-it==20) {
						state = STATE_VAR_MUTS_NT_OBJECT;
						return;
					}
				}
			}
			break;
		case STATE_OBJECT_END:
			if(end-it==5) {
				if(STR_INT32_EQ(end-4, ' }, ')) {
					state = STATE_ARRAY;
					return;
				}
			}
			else if(end-it==3) {
				if(STR_CHAR8_EQ(end-1, '}')) {
					state = STATE_ARRAY_END;
					return;
				}
			}
			break;
		case STATE_V_GENE_OBJECT:
			if(14<=end-it){
				long long v6 = *(long long*)(it+6);
				if(v6==STR_LONGLONG64('"all', '": "')) {
					if(STR_INT24_EQ(end-3, '", ')) {
						StringPart str;
						str.begin = it + 14;
						str.end = end - 3;
						seqs.back().v_all = str.toCode4();
						return;
					}
					else if(STR_CHAR8_EQ(end-1, '"')) {
						StringPart str;
						str.begin = it + 14;
						str.end = end - 1;
						seqs.back().v_all = str.toCode4();
						state = STATE_V_GENE_OBJECT_END;
						return;
					}
				}
				else if(v6==STR_LONGLONG64('"gen', 'e": ')) {
					if(STR_INT24_EQ(end-3, '", ')) {
						StringPart str;
						str.begin = it + 15;
						str.end = end - 3;
						seqs.back().v_gene = str.toCode4();
						return;
					}
					else if(STR_CHAR8_EQ(end-1, '"')) {
						StringPart str;
						str.begin = it + 15;
						str.end = end - 1;
						seqs.back().v_gene = str.toCode4();
						state = STATE_V_GENE_OBJECT_END;
						return;
					}
				}
				else if(v6==STR_LONGLONG64('"ful', 'l": ') || v6==STR_LONGLONG64('"fam', '": "')) {
					if(STR_INT24_EQ(end-3, '", ')) {
						return;
					}
					else if(STR_CHAR8_EQ(end-1, '"')) {
						state = STATE_V_GENE_OBJECT_END;
						return;
					}
				}
			}
			break;
		case STATE_J_GENE_OBJECT:
			if(14<=end-it){
				long long v6 = *(long long*)(it+6);
				if(v6==STR_LONGLONG64('"all', '": "')) {
					if(STR_INT24_EQ(end-3, '", ')) {
						StringPart str;
						str.begin = it + 14;
						str.end = end - 3;
						seqs.back().j_all = str.toCode4();
						return;
					}
					else if(STR_CHAR8_EQ(end-1, '"')) {
						StringPart str;
						str.begin = it + 14;
						str.end = end - 1;
						seqs.back().j_all = str.toCode4();
						state = STATE_J_GENE_OBJECT_END;
						return;
					}
				}
				else if(v6==STR_LONGLONG64('"gen', 'e": ')) {
					if(STR_INT24_EQ(end-3, '", ')) {
						StringPart str;
						str.begin = it + 15;
						str.end = end - 3;
						seqs.back().j_gene = str.toCode4();
						return;
					}
					else if(STR_CHAR8_EQ(end-1, '"')) {
						StringPart str;
						str.begin = it + 15;
						str.end = end - 1;
						seqs.back().j_gene = str.toCode4();
						state = STATE_J_GENE_OBJECT_END;
						return;
					}
				}
				else if(v6==STR_LONGLONG64('"ful', 'l": ') || v6==STR_LONGLONG64('"fam', '": "')) {
					if(STR_INT24_EQ(end-3, '", ')) {
						return;
					}
					else if(STR_CHAR8_EQ(end-1, '"')) {
						state = STATE_J_GENE_OBJECT_END;
						return;
					}
				}
			}
			break;
		case STATE_VAR_MUTS_NT_OBJECT:
			if(13<=end-it) {
				if(end-it==15) {
					if(STR_LONGLONG64_EQ(end-8, 'muts', '": [')) {
						state = STATE_VAR_MUTS_NT_MUTS_ARRAY;
						return;
					}
				}
				if(end-it==18) {
					if(STR_LONGLONG64_EQ(end-12, '"mut', 's": ') && STR_INT32_EQ(end-4, '[], ')) {
						return;
					}
				}
				if(STR_LONGLONG64_EQ(it+5, ' "nu', 'm": ')) {
					if('0'<=end[-1] && end[-1]<='9') {
						state = STATE_VAR_MUTS_NT_OBJECT_END;
						return;
					}
				}
			}
			break;
		case STATE_V_GENE_OBJECT_END:
		case STATE_J_GENE_OBJECT_END:
		case STATE_VAR_MUTS_NT_OBJECT_END:
			if(end-it==7) {
				if(STR_INT32_EQ(end-4, ' }, ')) {
					state = STATE_OBJECT;
					return;
				}
			}
			else if(end-it==5) {
				if(STR_CHAR8_EQ(end-1, '}')) {
					state = STATE_OBJECT_END;
					return;
				}
			}
			break;
		case STATE_VAR_MUTS_NT_MUTS_ARRAY:
			if(end-it==9 && STR_CHAR8_EQ(end-1, '{')) {
				seqs.back().muts.push_back(0LL);
				state = STATE_VAR_MUTS_NT_MUTS_OBJECT;
				return;
			}
			break;
		case STATE_VAR_MUTS_NT_MUTS_OBJECT:
			if(18<=end-it) {
				if(STR_LONGLONG64_EQ(it+10, '"loc', '": "')) {
					if(STR_INT24_EQ(end-3, '", ')) {
						StringPart str;
						str.begin = it + 18;
						str.end = end - 3;
						seqs.back().muts.back() |= str.toCode4();
						return;
					}
					else if(STR_CHAR8_EQ(end-1, '"')) {
						StringPart str;
						str.begin = it + 18;
						str.end = end - 1;
						seqs.back().muts.back() |= str.toCode4();
						state = STATE_VAR_MUTS_NT_MUTS_OBJECT_END;
						return;
					}
				}
				else if(STR_LONGLONG64_EQ(it+10, '"mut', '": "')) {
					if(STR_INT24_EQ(end-3, '", ')) {
						StringPart str;
						str.begin = it + 18;
						str.end = end - 3;
						seqs.back().muts.back() |= ((unsigned long long)str.toCode4()) << 32;
						return;
					}
					else if(STR_CHAR8_EQ(end-1, '"')) {
						StringPart str;
						str.begin = it + 18;
						str.end = end - 1;
						seqs.back().muts.back() |= ((unsigned long long)str.toCode4()) << 32;
						state = STATE_VAR_MUTS_NT_MUTS_OBJECT_END;
						return;
					}
				}
			}
			break;
		case STATE_VAR_MUTS_NT_MUTS_OBJECT_END:
			if(end-it==11) {
				if(STR_INT32_EQ(end-4, ' }, ')) {
					state = STATE_VAR_MUTS_NT_MUTS_ARRAY;
					return;
				}
			}
			else if(end-it==9) {
				if(STR_CHAR8_EQ(end-1, '}')) {
					state = STATE_VAR_MUTS_NT_MUTS_ARRAY_END;
					return;
				}
			}
			break;
		case STATE_VAR_MUTS_NT_MUTS_ARRAY_END:
			if(end-it==9) {
				if(STR_INT32_EQ(end-4, ' ], ')) {
					sort(seqs.back().muts.begin(), seqs.back().muts.end());
					state = STATE_VAR_MUTS_NT_OBJECT;
					return;
				}
			}
			else if(end-it==7) {
				if(STR_CHAR8_EQ(end-1, ']')) {
					sort(seqs.back().muts.begin(), seqs.back().muts.end());
					state = STATE_VAR_MUTS_NT_OBJECT_END;
					return;
				}
			}
			break;
		}
		LABEL_FUNC_START:
		switch(state) {
		case STATE_START:
			while(it!=end) {
				if(*it=='[') {
					++it;
					state = STATE_ARRAY;
					goto LABEL_STATE_ARRAY;
				}
				++it;
			}
			return;
			break;
		case STATE_END:
			return;
			break;
		case STATE_ARRAY:
		LABEL_STATE_ARRAY:
			while(it!=end) {
				if(*it=='{') {
					++it;
					seqs.push_back(Seq());
					state = STATE_OBJECT;
					goto LABEL_STATE_OBJECT;
				}
				++it;
			}
			return;
			break;
		case STATE_ARRAY_END:
		LABEL_STATE_ARRAY_END:
			while(it!=end) {
				if(*it==',') {
					++it;
					state = STATE_ARRAY;
					goto LABEL_STATE_ARRAY;
				}
				else if(*it==']') {
					++it;
					state = STATE_END;
					return;
				}
				++it;
			}
			return;
			break;
		case STATE_OBJECT:
		LABEL_STATE_OBJECT:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					next_state = STATE_UNKNOWN;
					unknown_return_state = STATE_OBJECT_END;
					int len = str.size();
					if(len==6) {
						int s2 = *(int*)(str.begin+2);
						static constexpr int strint_gene = 'eneg';//*(int*)"gene";
						static constexpr int strint_q_id = 'di_q';//*(int*)"q_id";
						static constexpr short strshort_v_ = '_v';//*(short*)"v_";
						static constexpr short strshort_j_ = '_j';//*(short*)"j_";
						static constexpr short strshort_se = 'es';//*(short*)"se";
						if(s2==strint_gene) {
							if(*(short*)(str.begin)==strshort_v_) {
								next_state = STATE_V_GENE;
							}
							else if(*(short*)(str.begin)==strshort_j_) {
								next_state = STATE_J_GENE;
							}
						}
						else if(s2==strint_q_id) {
							if likely(*(short*)(str.begin)==strshort_se) {
								next_state = STATE_SEQ_ID;
							}
						}
					}
					else if(len==7) {
						static constexpr int strint_junc = 'cnuj';//*(int*)"junc";
						static constexpr int strint__aa = 'aa_';//*(int*)"_aa";
						if likely(*(int*)(str.begin)==strint_junc) {
							if likely(((*(int*)(str.begin+4))&0x00FFFFFF)==strint__aa) {
								next_state = STATE_JUNC_AA;
							}
						}
					}
					else if(len==11) {
						static constexpr int strint_var_ = '_rav';//*(int*)"var_";
						static constexpr int strint_muts = 'stum';//*(int*)"muts";
						static constexpr int strint__nt = 'tn_';//*(int*)"_nt";
						if likely(*(int*)(str.begin)==strint_var_) {
							if likely(*(int*)(str.begin+4)==strint_muts) {
								if likely(((*(int*)(str.begin+8))&0x00FFFFFF)==strint__nt) {
									next_state = STATE_VAR_MUTS_NT;
								}
							}
						}
					}
					state = STATE_KEY_END;
					goto LABEL_STATE_KEY_END;
				}
			}
			return;
			break;
		case STATE_KEY_END:
		LABEL_STATE_KEY_END:
			while(it!=end) {
				if(*it==':') {
					++it;
					state = next_state;
					goto LABEL_FUNC_START;
				}
				++it;
			}
			return;
			break;
		case STATE_OBJECT_END:
		LABEL_STATE_OBJECT_END:
			while(it!=end) {
				if(*it==',') {
					++it;
					state = STATE_OBJECT;
					goto LABEL_STATE_OBJECT;
				}
				else if(*it=='}') {
					++it;
					state = STATE_ARRAY_END;
					goto LABEL_STATE_ARRAY_END;
				}
				++it;
			}
			return;
			break;
		case STATE_SEQ_ID:
			while(it!=end) {
				StringPart str;
				if(parse_string_pass(it, end/*, str*/)) {
					//seqs.back().id = str;
					state = STATE_OBJECT_END;
					goto LABEL_STATE_OBJECT_END;
				}
			}
			return;
			break;
		case STATE_JUNC_AA:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					seqs.back().junc = str;
					state = STATE_OBJECT_END;
					goto LABEL_STATE_OBJECT_END;
				}
			}
			return;
			break;
		case STATE_V_GENE:
			while(it!=end) {
				if(*it=='{') {
					++it;
					state = STATE_V_GENE_OBJECT;
					goto LABEL_STATE_V_GENE_OBJECT;
				}
				++it;
			}
			return;
			break;
		case STATE_V_GENE_OBJECT:
		LABEL_STATE_V_GENE_OBJECT:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					next_state = STATE_UNKNOWN;
					unknown_return_state = STATE_V_GENE_OBJECT_END;
					if(str.size()==4) {
						static constexpr int strint_gene = 'eneg';//*(int*)"gene";
						if(*(int*)str.begin==strint_gene) {
							next_state = STATE_V_GENE_GENE;
						}
					}
					else if(str.size()==3) {
						static constexpr int strint_all = 'lla';//*(int*)"all";
						if((*(int*)str.begin&0x00FFFFFF)==strint_all) {
							next_state = STATE_V_GENE_ALL;
						}
					}
					state = STATE_KEY_END;
					goto LABEL_STATE_KEY_END;
				}
			}
			return;
			break;
		case STATE_V_GENE_OBJECT_END:
		LABEL_STATE_V_GENE_OBJECT_END:
			while(it!=end) {
				if(*it==',') {
					++it;
					state = STATE_V_GENE_OBJECT;
					goto LABEL_STATE_V_GENE_OBJECT;
				}
				else if(*it=='}') {
					++it;
					state = STATE_OBJECT_END;
					goto LABEL_STATE_OBJECT_END;
				}
				++it;
			}
			return;
			break;
		case STATE_V_GENE_ALL:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					seqs.back().v_all = str.toCode4();
					state = STATE_V_GENE_OBJECT_END;
					goto LABEL_STATE_V_GENE_OBJECT_END;
				}
			}
			return;
			break;
		case STATE_V_GENE_GENE:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					seqs.back().v_gene = str.toCode4();
					state = STATE_V_GENE_OBJECT_END;
					goto LABEL_STATE_V_GENE_OBJECT_END;
				}
			}
			return;
			break;
		case STATE_J_GENE:
			while(it!=end) {
				if(*it=='{') {
					++it;
					state = STATE_J_GENE_OBJECT;
					goto LABEL_STATE_J_GENE_OBJECT;
				}
				++it;
			}
			return;
			break;
		case STATE_J_GENE_OBJECT:
		LABEL_STATE_J_GENE_OBJECT:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					next_state = STATE_UNKNOWN;
					unknown_return_state = STATE_J_GENE_OBJECT_END;
					if(str.size()==4) {
						static constexpr int strint_gene = 'eneg';//*(int*)"gene";
						if(*(int*)str.begin==strint_gene) {
							next_state = STATE_J_GENE_GENE;
						}
					}
					else if(str.size()==3) {
						static constexpr int strint_all = 'lla';//*(int*)"all";
						if((*(int*)str.begin&0x00FFFFFF)==strint_all) {
							next_state = STATE_J_GENE_ALL;
						}
					}
					state = STATE_KEY_END;
					goto LABEL_STATE_KEY_END;
				}
			}
			return;
			break;
		case STATE_J_GENE_OBJECT_END:
		LABEL_STATE_J_GENE_OBJECT_END:
			while(it!=end) {
				if(*it==',') {
					++it;
					state = STATE_J_GENE_OBJECT;
					goto LABEL_STATE_J_GENE_OBJECT;
				}
				else if(*it=='}') {
					++it;
					state = STATE_OBJECT_END;
					goto LABEL_STATE_OBJECT_END;
				}
				++it;
			}
			return;
			break;
		case STATE_J_GENE_ALL:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					seqs.back().j_all = str.toCode4();
					state = STATE_J_GENE_OBJECT_END;
					goto LABEL_STATE_J_GENE_OBJECT_END;
				}
			}
			return;
			break;
		case STATE_J_GENE_GENE:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					seqs.back().j_gene = str.toCode4();
					state = STATE_J_GENE_OBJECT_END;
					goto LABEL_STATE_J_GENE_OBJECT_END;
				}
			}
			return;
			break;
		case STATE_VAR_MUTS_NT:
			while(it!=end) {
				if(*it=='{') {
					++it;
					state = STATE_VAR_MUTS_NT_OBJECT;
					goto LABEL_STATE_VAR_MUTS_NT_OBJECT;
				}
				++it;
			}
			return;
			break;
		case STATE_VAR_MUTS_NT_OBJECT:
		LABEL_STATE_VAR_MUTS_NT_OBJECT:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					next_state = STATE_UNKNOWN;
					unknown_return_state = STATE_VAR_MUTS_NT_OBJECT_END;
					static constexpr int strint_muts = 'stum';//*(int*)"muts";
					if(str.size()==4 && strint_muts==*(int*)str.begin) {
						next_state = STATE_VAR_MUTS_NT_MUTS;
					}
					state = STATE_KEY_END;
					goto LABEL_STATE_KEY_END;
				}
			}
			return;
			break;
		case STATE_VAR_MUTS_NT_OBJECT_END:
		LABEL_STATE_VAR_MUTS_NT_OBJECT_END:
			while(it!=end) {
				if(*it==',') {
					++it;
					state = STATE_VAR_MUTS_NT_OBJECT;
					goto LABEL_STATE_VAR_MUTS_NT_OBJECT;
				}
				else if(*it=='}') {
					++it;
					state = STATE_OBJECT_END;
					goto LABEL_STATE_OBJECT_END;
				}
				++it;
			}
			return;
			break;
		case STATE_VAR_MUTS_NT_MUTS:
			while(it!=end) {
				if(*it=='[') {
					++it;
					state = STATE_VAR_MUTS_NT_MUTS_ARRAY;
					goto LABEL_STATE_VAR_MUTS_NT_MUTS_ARRAY;
				}
				++it;
			}
			return;
			break;
		case STATE_VAR_MUTS_NT_MUTS_ARRAY:
		LABEL_STATE_VAR_MUTS_NT_MUTS_ARRAY:
			while(it!=end) {
				if(*it=='{') {
					++it;
					seqs.back().muts.push_back(0LL);
					state = STATE_VAR_MUTS_NT_MUTS_OBJECT;
					goto LABEL_STATE_VAR_MUTS_NT_MUTS_OBJECT;
				}
				else if(*it==']') {
					++it;
					state = STATE_VAR_MUTS_NT_OBJECT_END;
					goto LABEL_STATE_VAR_MUTS_NT_OBJECT_END;
				}
				++it;
			}
			return;
			break;
		case STATE_VAR_MUTS_NT_MUTS_ARRAY_END:
		LABEL_STATE_VAR_MUTS_NT_MUTS_ARRAY_END:
			while(it!=end) {
				if(*it==',') {
					++it;
					state = STATE_VAR_MUTS_NT_MUTS_ARRAY;
					goto LABEL_STATE_VAR_MUTS_NT_MUTS_ARRAY;
				}
				else if(*it==']') {
					++it;
					sort(seqs.back().muts.begin(), seqs.back().muts.end());
					state = STATE_VAR_MUTS_NT_OBJECT_END;
					goto LABEL_STATE_VAR_MUTS_NT_OBJECT_END;
				}
				++it;
			}
			return;
			break;
		case STATE_VAR_MUTS_NT_MUTS_OBJECT:
		LABEL_STATE_VAR_MUTS_NT_MUTS_OBJECT:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					next_state = STATE_UNKNOWN;
					unknown_return_state = STATE_VAR_MUTS_NT_MUTS_OBJECT_END;
					if(str.size()==3) {
						static constexpr int strint_loc = 'col';//*(int*)"loc";
						static constexpr int strint_mut = 'tum';//*(int*)"mut";
						int s0 = (*(int*)str.begin) & 0x00FFFFFF;
						if(s0==strint_loc) {
							next_state = STATE_VAR_MUTS_NT_MUTS_LOC;
						}
						else if(s0==strint_mut) {
							next_state = STATE_VAR_MUTS_NT_MUTS_MUT;
						}
					}
					state = STATE_KEY_END;
					goto LABEL_STATE_KEY_END;
				}
			}
			return;
			break;
		case STATE_VAR_MUTS_NT_MUTS_OBJECT_END:
		LABEL_STATE_VAR_MUTS_NT_MUTS_OBJECT_END:
			while(it!=end) {
				if(*it==',') {
					++it;
					state = STATE_VAR_MUTS_NT_MUTS_OBJECT;
					goto LABEL_STATE_VAR_MUTS_NT_MUTS_OBJECT;
				}
				else if(*it=='}') {
					++it;
					state = STATE_VAR_MUTS_NT_MUTS_ARRAY_END;
					goto LABEL_STATE_VAR_MUTS_NT_MUTS_ARRAY_END;
				}
				++it;
			}
			return;
			break;
		case STATE_VAR_MUTS_NT_MUTS_LOC:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					seqs.back().muts.back() |= str.toCode4();
					state = STATE_VAR_MUTS_NT_MUTS_OBJECT_END;
					goto LABEL_STATE_VAR_MUTS_NT_MUTS_OBJECT_END;
				}
			}
			return;
			break;
		case STATE_VAR_MUTS_NT_MUTS_MUT:
			while(it!=end) {
				StringPart str;
				if(parse_string(it, end, str)) {
					seqs.back().muts.back() |= ((unsigned long long)str.toCode4()) << 32;
					state = STATE_VAR_MUTS_NT_MUTS_OBJECT_END;
					goto LABEL_STATE_VAR_MUTS_NT_MUTS_OBJECT_END;
				}
			}
			return;
			break;
		case STATE_UNKNOWN:
			while(it!=end) {
				if(*it=='[') {
					unknown_return_state_array.clear();
					unknown_return_state_array.push_back(unknown_return_state);
					state = STATE_UNKNOWN_ARRAY;
					goto LABEL_STATE_UNKNOWN_ARRAY;
				}
				else if(*it=='{') {
					unknown_return_state_array.clear();
					unknown_return_state_array.push_back(unknown_return_state);
					state = STATE_UNKNOWN_OBJECT;
					goto LABEL_STATE_UNKNOWN_OBJECT;
				}
				if(parse_string_pass(it, end)) {
					state = unknown_return_state;
					goto LABEL_FUNC_START;
				}
			}
			return;
			break;
		case STATE_UNKNOWN_ARRAY:
		LABEL_STATE_UNKNOWN_ARRAY:
			while(it!=end) {
				if(*it=='[') {
					unknown_return_state_array.push_back(STATE_UNKNOWN_ARRAY_END);
					state = STATE_UNKNOWN_ARRAY;
					goto LABEL_STATE_UNKNOWN_ARRAY;
				}
				else if(*it=='{') {
					unknown_return_state_array.push_back(STATE_UNKNOWN_ARRAY_END);
					state = STATE_UNKNOWN_OBJECT;
					goto LABEL_STATE_UNKNOWN_OBJECT;
				}
				if(parse_string_pass(it, end)) {
					assert(!unknown_return_state_array.empty());
					state = unknown_return_state_array.back();
					unknown_return_state_array.pop_back();
					goto LABEL_FUNC_START;
				}
			}
			return;
			break;
		case STATE_UNKNOWN_ARRAY_END:
			while(it!=end) {
				if(*it==',') {
					state = STATE_UNKNOWN_ARRAY;
					goto LABEL_STATE_UNKNOWN_ARRAY;
				}
				else if(*it==']') {
					assert(!unknown_return_state_array.empty());
					state = unknown_return_state_array.back();
					unknown_return_state_array.pop_back();
					goto LABEL_FUNC_START;
				}
				++it;
			}
			return;
			break;
		case STATE_UNKNOWN_OBJECT:
		LABEL_STATE_UNKNOWN_OBJECT:
			while(it!=end) {
				if(parse_string_pass(it, end)) {
					next_state = STATE_UNKNOWN_OBJECT_VALUE;
					state = STATE_KEY_END;
					goto LABEL_STATE_KEY_END;
				}
			}
			return;
			break;
		case STATE_UNKNOWN_OBJECT_VALUE:
		LABEL_STATE_UNKNOWN_OBJECT_VALUE:
			while(it!=end) {
				if(*it=='[') {
					unknown_return_state_array.push_back(STATE_UNKNOWN_OBJECT_END);
					state = STATE_UNKNOWN_ARRAY;
					goto LABEL_STATE_UNKNOWN_ARRAY;
				}
				else if(*it=='{') {
					unknown_return_state_array.push_back(STATE_UNKNOWN_OBJECT_END);
					state = STATE_UNKNOWN_OBJECT;
					goto LABEL_STATE_UNKNOWN_OBJECT;
				}
				if(parse_string_pass(it, end)) {
					assert(!unknown_return_state_array.empty());
					state = unknown_return_state_array.back();
					unknown_return_state_array.pop_back();
					goto LABEL_FUNC_START;
				}
			}
			return;
			break;
		case STATE_UNKNOWN_OBJECT_END:
			while(it!=end) {
				if(*it==',') {
					state = STATE_UNKNOWN_OBJECT;
					goto LABEL_STATE_UNKNOWN_OBJECT;
				}
				else if(*it=='}') {
					assert(!unknown_return_state_array.empty());
					state = unknown_return_state_array.back();
					unknown_return_state_array.pop_back();
					goto LABEL_FUNC_START;
				}
				++it;
			}
			return;
			break;
		}
	}
	void read(const string & line) {
		const char * begin = &line[0];
		const char * end = begin + line.size();
		read(begin, end);
	}
	void read(const vector<string> & lines) {
		for(int i=0; i<lines.size(); ++i) {
			read(lines[i]);
		}
	}
	const vector<Seq> & getSeqs() {
		return seqs;
	}
};

const static double cutoff = 0.32;
const static double cutoffHalf = cutoff * 0.45;

static void solve(const int N, const vector<Seq>& seqs, int * cluster) {//solve7
	vector<pair<int, bool> > pivots;
	for(int i=N-1; 0<=i; --i) {
		int minJ = -1;
		double minDist = cutoff+(1e-9);
		for(int j=0; j<pivots.size(); ++j) {
			double dist = GetScore(seqs[i], seqs[pivots[j].first]);
			if(dist<minDist) {
				minDist = dist;
				minJ = j;
				if(dist<=cutoffHalf) {
					break;
				}
			}
		}
		if(minJ!=-1) {
			cluster[i] = minJ+1;
			if(pivots[minJ].second) {
				pivots[minJ].second = false;
				if(seqs[i].junc.size()>seqs[pivots[minJ].first].junc.size()) {
					pivots[minJ].first = i;
				}
			}
		}
		else {
			pivots.push_back(pair<int, bool>(i, true));
			cluster[i] = pivots.size();
		}
	}
}

class ABCSpeedup {
public:
	vector <string> cluster(const vector <string> & antibody) {
		MyJsonReader reader;
		reader.read(antibody);
		int N = reader.getSeqs().size();
		int *flat_cluster = new int[N];
		solve(N, reader.getSeqs(), flat_cluster);

		int maxC = 0;
		for(int i=0; i<N; ++i) {
			maxC = max(maxC, flat_cluster[i]);
		}
		vector<string> vec;
		vec.resize(maxC+1);
		for(int i=0; i<=maxC; ++i) {
			char buf[256];
			sprintf(buf, "%d", i);
			vec[i] = buf;
		}

		vector<string> ret;
		ret.resize(N);
		for(int i=0; i<N; ++i) {
			ret[i] = vec[flat_cluster[i]];
		}
		delete[] flat_cluster;
		return ret;
	}
};
